import UserResponse from './UserResponse' 
import  AccountResponse from './AccountResponse' 
import AccRoleRelVO from '../vo/AccRoleRelVO'
import BaseEnumFactory from '/@/constant/BaseEnumFactory';


/** 用户及关联的角色账号信息 */
export default class UserAccRoleResponse  { 
  tUser!:UserResponse;
  roleRelList!:AccRoleRelVO[];
  tAccount!:AccountResponse;

  constructor(){
    this.tUser=new UserResponse();
    this.roleRelList=[];
    this.tAccount=new AccountResponse();
  }

  /**通过JSONObject创建实例对象 */
  public static getInstanceByJSONObj(jsonObj:any):UserAccRoleResponse{  
    let instance=new UserAccRoleResponse()  
    let rs= Object.assign(instance, jsonObj) 
    rs.tAccount.password="*********"
    if(rs.tUser.userSex==null) rs.tUser.userSex=BaseEnumFactory.UserEnum_UserSex.UNKNOWN_TYPE;
    if(rs.tUser.userType==null) rs.tUser.userSex=BaseEnumFactory.UserEnum_UserType.UNKNOWN_TYPE;
    console.log("AXIOS工具类UserAccRoleResponse构造方法调用,",rs)
    return rs
  }


  /** 通过属性参数创建实例对象 */
  public static getInstanceByParam(tUser:UserResponse,roleRelList:AccRoleRelVO[]
                                   ,tAccount:AccountResponse){ 
    let instance=new UserAccRoleResponse()  
    instance.tUser=tUser;
    instance.roleRelList=roleRelList;
    instance.tAccount=tAccount;
    instance.tAccount.password="*********"
    return instance 
  }


  /** 类属性的申明静态变量(适用于直接用到Class.fieldName的场景) */
   static fieldNames={ tUser:"tUser",roleRelList:"roleRelList",tAccount:"tAccount" } 
}

